// 基于state的getter计算属性
export default {
  goods: (state) => state.goods,
  totalCount (state){
    return state.cartFoods.reduce((preTotal,food)=>preTotal+food.count,0)
  },
  totalPrice (state){
    return state.cartFoods.reduce((preTotal,food)=>preTotal+food.count*food.price,0)
  },

  prevtiveSize(state){
    return state.ratings.reduce((preTotal,rating)=>preTotal+(rating.rateType === 0?1:0),0)
  }
}
